﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace GenerateGuideLines
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            StreamReader sr = new StreamReader("temp2.txt", Encoding.GetEncoding("gb2312"));
            string str = sr.ReadToEnd();
            sr.Close();
         
            string[] names = str.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

            StringBuilder sb = new StringBuilder();          
            int i = 1;
            foreach (string name in names)
            {
                sb.Append("[Serializable]\r\npublic class GL" + i.ToString() + " : GuideLine\r\n{\r\n\tpublic override int GetID()\r\n\t{\r\n\t\treturn " +i.ToString() + ";\r\n\t}\r\n\r\n\tpublic override string GetName()\r\n\t{\r\n\t\treturn \"" + name.Trim() + "\";\r\n\t}\r\n}\r\n\r\n");
                i += 1;
            }

            StreamWriter sw = new StreamWriter("aa.txt");
            sw.Write(sb.ToString());
            sw.Close();
        }
    }
}
